import service from "@/utils/request";

export function sendCodeService(params = {}) {
  return service({
    url: "/user/sendCode",
    method: "post",
    data: params,
  });
}

export function codeLoginService(params = {}) {
  return service({
    url: "/user/code/login",
    method: "post",
    data: params,
  });
}

export function logoutService(){
  return service({
    url: "/user/logout",
    method: "delete",
  });
} 

export function getUserInfoService(){
  return service({
    url: "/user/info",
    method: "get",
  });
} 

export function getUserDetailService(){
  return service({
    url: "/user/detail",
    method: "get",
  });
} 

export function editUserService(userDetailForm){
  return service({
    url: "/user/edit",
    method: "put",
    data: userDetailForm,
  });
} 

export function updateHeadImageService(headImage){
  return service({
    url: "/user/head-image/update",
    method: "post",
    params: {headImage}
  });
} 

export function userSubmitService(params){
  return service({
    url: "/user/question/submit/mq",
    method: "post",
    data: params
  });
}

export function getQuestionResultService(examId, questionId, currentTime) {
  return service({
    url: "/user/question/exe/result",
    method: "get",
    params: {examId, questionId, currentTime},
  });
}